<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table tr td{
            border: 1px solid black;
            
        }

        table{
            border-collapse: collapse;
        }
    </style>
</head>
<body>
    <table>

    </table>
    <script>

var body = document.body;
         console.log(body);
        table(3,5);
        function table(m,n){
            for(var i = 0;i< m;i++){
                var tr = document.createElement('tr');
                for(var j = 0;j < n;j++){
                    var td = document.createElement('td');
                    var textNodeValue = parseInt(Math.random()*100) + 1;
                    var text = document.createTextNode(textNodeValue);
                    td.appendChild(text);
                    tr.appendChild(td);
                }
                document.getElementsByTagName('table')[0].appendChild(tr);
            }

            
        }
    </script>


</body>

</html>